package com.wuxiaofan.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.order.entity.PaymentInfo;
import com.wuxiaofan.order.entity.custom.PaymentInfoCustom;
import com.wuxiaofan.order.mapper.PaymentInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.order.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class PaymentInfoService {
    @Autowired
    private PaymentInfoMapper omsPaymentInfoMapper;
    @Resource
    private Idgenerator idgenerator;
    public PaymentInfo findById(String id){
        return omsPaymentInfoMapper.selectById(id);
    }

    public PaymentInfoCustom findCountByMap(Map paraMap){
        return omsPaymentInfoMapper.findCountByMap(paraMap);
    }

    public PaymentInfoCustom findGroupByMap(Map paraMap){
        return omsPaymentInfoMapper.findGroupByMap(paraMap);
    }

    public List<PaymentInfoCustom> findByMap(Map paraMap){
        return omsPaymentInfoMapper.findByMap(paraMap);
    }

    public Page<PaymentInfoCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(omsPaymentInfoMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        omsPaymentInfoMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        omsPaymentInfoMapper.deleteById(id);
    }

    public PaymentInfo save(PaymentInfo omsPaymentInfo){
        omsPaymentInfo.setId(idgenerator.getId());
        omsPaymentInfoMapper.insert(omsPaymentInfo);
        return omsPaymentInfo;
    }

}
